<?php
require_once("../../class2.php");
require_once(HEADERF);
		$user_id = USERID;
		$user_name = USERNAME;
require_once("./includes/require_all.php");

ramka("open"); if($user_rights["ADD"]===1 && USERNAME!='USERNAME') {

//---> Common variables
CMS_activitySave("famehall.php");

echo "<a href='filestable.php?game=$CMS_game' class='forumheader4' style='font-size:14px; margin-left:10px;'>НАЗАД</a><br>";
echo "<center class='forumheader4' style='margin-top:-20px; margin-left:-1px; padding-bottom:10px;'><h1 style='border-bottom:0px;'>Участвали в превода</h1></center>";
CMS_lastApprovedEcho();

//---> Total strings count selection
$tempo= mysql_fetch_array(mysql_query("SELECT rows_all,rows_translated FROM admin_panel WHERE game_prefix = '$CMS_pref'"));
$allphrases= $tempo['rows_all']; $alltranslated= $tempo['rows_translated'];
$tempo= mysql_fetch_array(mysql_query("SELECT round(sum(char_length(content))/1800) as chars FROM $text_table WHERE translator!='original'"));
$allchars= $tempo['chars'];

$translators = mysql_query("SELECT translator as name, COUNT(translator) as repliques, round(sum(char_length(content))/1800,2) as pages FROM $text_table WHERE translator!='original' AND translator!='' GROUP BY translator ORDER BY pages DESC");

?>
<div class="forumheader">
	<table cellpadding='5' width=100%>
		<tr>
			<td style="width:10%"></td>
			<td style="width:20%">Преводач:</td>
			<td style="width:30%">Машинописни страници:</td>
			<td style="width:20%">Реплики в превода:</td>
			<td style="width:20%"></td>
		</tr>
<?php

WHILE ($translator=mysql_fetch_assoc($translators))
{
	$percent= number_format(round(($translator['repliques']*100)/$allphrases, 2), 2, ',', ' ');
	$percent2=number_format(round(($translator['pages']*100)/$allchars, 2), 2, ',', ' '); 
?>
		<tr class='forumheader3 textGREY' style='font-weight:normal;'>
			<td style="width:10%" class="unselectable"><img align="right" width="14px" heght="14px" src="icons/user.png"></td>
			<td style="width:20%;" class="textWHITE"><?=$translator['name']?></td>
			<td style="width:30%; clear:both;"><span class='unselectable textGREEN' style="display: inline; float: left; min-width: 50px;"><?=$translator['pages']?></span><span><?=$percent2?>%<span style='font-size:10px;'> от преведения текст</span></span></td>
			<td style="width:30%"><span class='unselectable textGREEN' style="display: inline; float: left; min-width: 50px;"><?=$translator['repliques']?></span><span><?=$percent?>%<span style='font-size:10px;'> от всички реплики</span></span></td>
			<td style="width:10%; clear:both;"></td>
		</tr>
<?php
};
?>
	</table>
</div>
<div class='forumheader'>
	Преведени са общо <?=$alltranslated?> реплики, равняващи се на <?=$allchars?> маш.стр.
</div>
<?php

} else echo"<div class='forumheader'>Нямате право да разглеждате този ресурс.</div>"; ramka("close");
require_once(FOOTERF);
?>